#ifndef TCURVE_H
#define TCURVE_H

#include <qwt_plot_curve.h>
#include <qwt_curve_fitter.h>
#include <qwt_spline.h>
#include <qwt_symbol.h>


class TCurve : private QwtPlotCurve
{
    QwtSplineCurveFitter * fitter;
    QVector< QPointF > points;
    QwtSymbol * dot;
    bool useSpline;

public:
    explicit TCurve( QString Name );
    //~TCurve();

    void UseSpline( bool s );
    bool UseSpline() { return useSpline; }

    int PointsCount() { return points.count()-1; }

    void SetSplineSize( int n = 100000 );
    int SplineSize() const { return fitter->splineSize(); }

    void SetPen( const QPen & p ) { setPen( p ); }
    const QPen & Pen() const { return pen(); }

    const QwtText & Title() const { return title(); }

    void SetSamples( const QVector< QPointF > & p );
    void Attach( QwtPlot * p ) { attach( p ); }

    double GetY( double x );

    void SetDotStyle( QwtSymbol::Style s = QwtSymbol::NoSymbol ) { dot->setStyle( s ); }
    QwtSymbol::Style DotStyle() const { return dot->style(); }

    void SetDotColor( QColor c = Qt::black );
    QColor DotColor() const { return dot->pen().color(); }

    void SetDotSize( int s = 0 ) { dot->setSize( s ); }
    int DotSize() const { return dot->size().width(); }

    QVector< QPointF > Points() { return points; }
    
};

#endif // TCURVE_H
